﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using QLMB.ViewModels;
using QLMB.Models;

namespace QLMB.Controllers
{
    public class RouterController : BaseController
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult DuongBay()
        {
            return View(this.Repository.DSDuongBay());
        }

        public ActionResult DuongBayKhac()
        {
            return View(this.Repository.DSDuongBayKhac());
        }

        [HttpGet]
        public ActionResult EditDuongBay(DUONGBAY dbitem)
        {
            return View(dbitem);
        }
        [HttpPost]
        public ActionResult EditDuongBay(DUONGBAY dbitem, int dif = 1)
        {
            if (this.Repository.CapNhatDuongBay(dbitem))
            {
                return RedirectToAction("UpdateSubmit");
            }
            else
            {
                return View(dbitem);
            }

        }

        [HttpGet]
        public ActionResult TaoDuongBay()
        {
            RouterItem ritem = new RouterItem();
            ritem.DSSanBay = this.Repository.LayDsSanBay();
            return View();
        }

        public ActionResult UpdateSubmit()
        {
            return View();
        }
    }
}
